﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebAsp.Admin.News.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyContainerAdmin" runat="server">
<div class="btnCreat">
    <asp:Button ID="Creat" runat="server" Text="Đăng tin tức mới" onclick="btnCreat_Click"/>
</div>
<div>
    <asp:GridView ID="ListNews" runat="server" AutoGenerateColumns="False" 
        onrowcommand="ListNews_RowCommand">
        <Columns>
            <asp:TemplateField HeaderText="STT">
                <ItemTemplate>     
                    <%# Container.DataItemIndex + 1 %>     
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" Width="60px" />
            </asp:TemplateField>
            <asp:BoundField DataField="Title" HeaderText="Tiêu đề">
            <ItemStyle HorizontalAlign="Left" Width="450px" />
            </asp:BoundField>
            <asp:BoundField HeaderText="Danh mục" DataField="CategoryName">
            <ItemStyle Width="250px" />
            </asp:BoundField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="Edit" runat="server" CausesValidation="false" 
                        CommandName="EditRow" CommandArgument='<%# Eval("ID") %>' Text="Sửa"></asp:LinkButton>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="Delete" runat="server" CausesValidation="false" 
                        CommandName="DeleteRow" Text="Xóa" CommandArgument='<%#Eval("ID") %>' OnClientClick="return confirm('Bạn có chắc muốn xóa không?')"></asp:LinkButton>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</div>
</asp:Content>
